<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2018/2/11
 * Time: 1:17
 */

use yii\helpers\Url;

$web = Url::base();
?>


<div class="form-horizontal" id="data_form">
    <input type="hidden" id="id" name="id" class="form-control"
           value="<?= isset($item['id']) != null ? $item['id'] : '' ?>">

    <div class="form-group">
        <label class="control-label col-lg-2" for="name"><span
                    class="font-color-attention">*</span>名称：</label>
        <div class="col-lg-10">
            <input type="text" id="name" name="name" class="form-control"
                   value="<?= $item != null ? $item['name'] : '' ?>">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-lg-2" for="raw_id"><span
                    class="font-color-attention">*</span>原始ID：</label>
        <div class="col-lg-10">
            <input type="text" id="raw_id" name="raw_id" class="form-control"
                   value="<?= $item != null ? $item['raw_id'] : '' ?>">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-lg-2" for="app_id"><span
                    class="font-color-attention">*</span>APP_ID：</label>
        <div class="col-lg-10">
            <input type="text" id="app_id" name="app_id" class="form-control"
                   value="<?= $item != null ? $item['app_id'] : '' ?>">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-lg-2" for="app_secret"><span
                    class="font-color-attention">*</span>APP_Secret：</label>
        <div class="col-lg-10">
            <input type="text" id="app_secret" name="app_secret" class="form-control"
                   value="<?= $item != null ? $item['app_secret'] : '' ?>">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-lg-2" for="type"><span
                    class="font-color-attention">*</span>类型：</label>
        <div class="col-lg-4">
            <select class='select-group' id="type" name="type">
                <option value="1" <?php echo $item['type'] == '1' ? 'selected' : '' ?>>支付宝小程序</option>
                <option value="2" <?php echo $item['type'] == '2' ? 'selected' : '' ?>>微信小程序</option>
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-lg-2" for="begin_datetime"><span
                    class="font-color-attention">*</span>开通时间：</label>
        <div class="col-lg-4">
            <span class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd"
                  data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text" readonly id="begin_datetime" name="begin_datetime"
                       placeholder="开通时间"
                       value="<?= $item != null ? \app\librarys\Tools::getDatetimeFormat($item['begin_datetime'], 'Y-m-d') : '' ?>">
                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </span>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-lg-2" for="end_datetime"><span
                    class="font-color-attention">*</span>失效时间：</label>
        <div class="col-lg-4">
            <span class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd"
                  data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text" readonly id="end_datetime" name="end_datetime"
                       placeholder="失效时间"
                       value="<?= $item != null ? \app\librarys\Tools::getDatetimeFormat($item['end_datetime'], 'Y-m-d') : '' ?>">
                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </span>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-lg-2" for="is_enabled">启用：</label>
        <div class="col-lg-10">
            <div class="checkbox-switch-wrapper">
                <input class="checkbox-switch" type="checkbox" id="is_enabled" name="is_enabled"
                    <?php
                    if (isset($item['is_enabled']) && $item['is_enabled'] == 1) {
                        echo 'checked="checked"';
                    } else if (!isset($item['is_enabled'])) {
                        echo 'checked="checked"';
                    }
                    ?>
                >
                <div class="checkbox-switch-circle"></div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    $('.form_date').datetimepicker({
        language: 'zh-CN',
        weekStart: 1,
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
</script>